<extend name="Public/base"/>

<block name="body">
    <div class="main-title">
        <h2>用户反馈管理 </h2>
    </div>

    <div class="cf">
        <span class=""><h3>平台账户余额：{$account}元</h3></span>
        <br/>
        <a class="btn r0" href="__CONTROLLER__/index/record/0">待记录</a>
        <a class="btn r1" href="__CONTROLLER__/index/record/1">已记录</a>
        <a class="btn r1" href="__CONTROLLER__/index/uid/0">查看平台流水</a>
        <!-- 高级搜索 -->
        <!-- <div class="search-form fr cf">
            <div class="sleft">
                <input type="text" name="title" class="search-input" value="{:I('title')}" placeholder="请输入菜单名称">
                <a class="sch-btn" href="javascript:;" id="search" url="__SELF__"><i class="btn-search"></i></a>
            </div>
        </div> -->
    </div>

    <div class="data-table table-striped">
        <form class="ids">
            <table>
                <thead>
                    <tr>
                        <th class="row-selected">
                            <input class="checkbox check-all" type="checkbox">
                        </th>
                        <th>用户昵称</th>
                        <th>变动金额</th>
                        <th>用户行为：
                            <select>
                                <option value="">全部</option>
                                <option value="3" <eq name="Think.get.action" value="3">selected="selected"</eq> >提现</option>
                                <option value="0" <eq name="Think.get.action" value="0">selected="selected"</eq> >充值</option>
                                <option value="1" <eq name="Think.get.action" value="1">selected="selected"</eq> >付款</option>
                                <option value="2" <eq name="Think.get.action" value="2">selected="selected"</eq> >收入</option>
                            </select>
                        </th>
                        <th>交易时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
				<notempty name="data">
                <volist name="data" id="v">
                    <tr>
                        <td><input class="ids row-selected" type="checkbox" name="ids[]" value="{$v.id}"></td>
                        <td>
                            <a href="javascript:;">{$v.nickname}</a>
                        </td>
                        <td><if condition="$v.action eq 0 || $v.action eq 2">+<else/>-</if>{$v.change}</td>
                        <td>
                            <switch name="v.action">
                                <case value="0">充值</case>
                                <case value="1">付款</case>
                                <case value="2">收入</case>
                                <case value="3">提现</case>
                            </switch>
                        </td>
                        <td>{$v.create_time|date='Y/m/d H:i:s',###}</td>
                        <td>
                            <a class="oper" href="javascript:;" data="{$v.id}" val='1' flag="record">
                                <neq name="Think.get.record" value="1">记录</neq>
                            </a>
                            <a class="oper" href="javascript:;" data="{$v.id}" val='2' flag="status"><eq name="Think.get.record" value="1">删除</eq></a>
                        </td>
                    </tr>
                </volist>
				<else/>
				<td colspan="10" class="text-center"> aOh! 暂时还没有内容! </td>
				</notempty>
                </tbody>
            </table>
        </form>
        <!-- 分页 -->
        <div class="page">
            {$_page}
        </div>
    </div>
</block>

<block name="script">
    <script type="text/javascript">
        $(function() {
            $('.oper').click(function(){
                var mes = $(this).html();
                if (confirm('确定要操作吗？')) {
                    var id = $(this).attr('data');
                    var val = $(this).attr('val');
                    var flag = $(this).attr('flag');
                    $.post('__CONTROLLER__/edit', {'id': id,'val':val, 'flag':flag}, function(msg) {
                        alert(msg);
                        location.reload();
                    });
                }
            });

            //选择用户行为筛选
            $('select').change(function(){
                filt('-1',$(this).val(),'-1');
            });

            //只看此用户
            // $('.showone').click(function(){
            //     filt($(this).attr('data'),'-1','-1');
            // })

            function filt(uid,action,record){
                if (uid == '-1') {
                    uid = "{$Think.get.uid}";
                }
                if (action == '-1') {
                    action = "{$Think.get.action}";
                }
                if (record == '-1') {
                    record = "{$Think.get.record}";
                }
                location.href = "__ACTION__" + "/uid/" + uid + "/action/" + action + "/record/" + record;
            }

            //记录按钮默认颜色
            $('.r' + "{$Think.get.record}").css('background','#0c7dac');

            
            //搜索功能
            // $("#search").click(function() {
            //     var url = $(this).attr('url');
            //     var query = $('.search-form').find('input').serialize();
            //     query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            //     query = query.replace(/^&/g, '');
            //     if (url.indexOf('?') > 0) {
            //         url += '&' + query;
            //     } else {
            //         url += '?' + query;
            //     }
            //     window.location.href = url;
            // });
            
            //导航高亮
            highlight_subnav('{:U('index')}');

            //回车搜索
            $(".search-input").keyup(function(e) {
                if (e.keyCode === 13) {
                    $("#search").click();
                    return false;
                }
            });

        });
    </script>
</block>